home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / term43-source.lha / Extras / Source / gtlayout-Source.lha / LTP_ImageClass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-21  |  2.2 KB  |  89 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1994 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. ULONG __regargs
  10. LTP_ImageClassDraw(struct Image *image,struct impDraw *drawMsg,ImageInfo *imageInfo)
  11. {
  12.     LTP_DrawBox(drawMsg -> imp_RPort,drawMsg -> imp_DrInfo,image -> LeftEdge + drawMsg -> imp_Offset . X,image -> TopEdge + drawMsg -> imp_Offset . Y,image -> Width,image -> Height,drawMsg -> imp_State == IDS_SELECTED,drawMsg -> imp_State == IDS_DISABLED,imageInfo);
  13.  
  14.     return(TRUE);
  15. }
  16.  
  17.  
  18. /*****************************************************************************/
  19.  
  20.  
  21. ULONG __regargs
  22. LTP_ImageClassErase(struct Image *image,struct impErase *eraseMsg)
  23. {
  24.     LONG left;
  25.     LONG top;
  26.  
  27.     left    = eraseMsg -> imp_Offset . X + image -> LeftEdge;
  28.     top    = eraseMsg -> imp_Offset . Y + image -> TopEdge;
  29.  
  30.     LTP_SetAPen(eraseMsg -> imp_RPort,0);
  31.     RectFill(eraseMsg -> imp_RPort,left,top,left + image -> Width - 1,top + image -> Height - 1);
  32.  
  33.     return(TRUE);
  34. }
  35.  
  36.  
  37. /*****************************************************************************/
  38.  
  39. ULONG __regargs
  40. LTP_ImageClassNew(struct IClass *class,Object *object,struct opSet *SetMethod)
  41. {
  42.     struct TagItem *Tag;
  43.  
  44.     if(Tag = FindTagItem(IIA_ImageType,SetMethod -> ops_AttrList))
  45.     {
  46.         struct Image *NewImage;
  47.  
  48.         if(NewImage = (struct Image *)DoSuperMethodA(class,object,(Msg)SetMethod))
  49.         {
  50.             struct ImageInfo *MoreInfo = INST_DATA(class,NewImage);
  51.  
  52.             MoreInfo -> ImageType    = Tag -> ti_Data;
  53.             MoreInfo -> GlyphWidth    = GetTagData(IIA_GlyphWidth,0,SetMethod -> ops_AttrList);
  54.             MoreInfo -> GlyphHeight = GetTagData(IIA_GlyphHeight,0,SetMethod -> ops_AttrList);
  55.  
  56.             return((ULONG)NewImage);
  57.         }
  58.     }
  59.  
  60.     return(NULL);
  61. }
  62.  
  63.  
  64. /*****************************************************************************/
  65.  
  66.  
  67. ULONG __saveds __asm
  68. LTP_ImageDispatch(register __a0 struct IClass *class,register __a2 Object *object,register __a1 Msg msg)
  69. {
  70.     switch(msg -> MethodID)
  71.     {
  72.         case IM_ERASE:
  73.  
  74.             return(LTP_ImageClassErase((struct Image *)object,(struct impErase *)msg));
  75.  
  76.         case IM_DRAW:
  77.  
  78.             return(LTP_ImageClassDraw((struct Image *)object,(struct impDraw *)msg,(ImageInfo *)INST_DATA(class,object)));
  79.  
  80.         case OM_NEW:
  81.  
  82.             return(LTP_ImageClassNew(class,object,(struct opSet *)msg));
  83.  
  84.         default:
  85.  
  86.             return(DoSuperMethodA(class,object,msg));
  87.     }
  88. }
  89.